package com.lemner.www.hongyu.Utils;

import android.content.Context;
import android.content.SharedPreferences;

import static android.content.Context.MODE_PRIVATE;


/**
 * Created by Administrator on 2017/8/3.
 */

public class PrefUtil {
    public static boolean getBoolean(Context context, String key) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        boolean result = sp.getBoolean(key, false);
        return result;
    }

    public static void SetBoolean(Context context, String key, boolean b) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        sp.edit().putBoolean(key, b);
    }

    public static String getString(Context context, String key, String moren) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        return sp.getString(key, moren);
    }

    public static void setString(Context context, String key, String result) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        sp.edit().putString(key, result).commit();
    }
}
